<%@ page contentType="text/html;charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="ctxPath" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Expires" content="0">
<title>单实体</title>
<link href="${ctxPath}/assets/global/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctxPath}/assets/global/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="${ctxPath}/assets/global/css/animate.css" rel="stylesheet">
<link href="${ctxPath}/assets/global/css/style.css?v=4.1.0" rel="stylesheet">
<link href="${ctxPath}/assets/global/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
<link href="${ctxPath}/assets/global/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
</head>
<body class="white-bg">
<div class="row wrapper border-dashed-bottom page-heading">
	<div class="col-sm-4">
		<div class="page-title">单实体</div>
	</div>
	<div class="col-sm-8">
		<div class="page-command">[修改]</div>
	</div>
</div>
<div class="row wrapper border-bottom page-action">
	<div class="col-sm-12">
		<button class="btn btn-primary btn-sm" type="button" id="btnSave"><i class="fa fa-save"></i>&nbsp;保存&nbsp;</button>
		<button class="btn btn-default btn-sm" type="button" id="btnReset"><i class="fa fa-undo"></i>&nbsp;重置&nbsp;</button>
	</div>
</div>
<div class="wrapper wrapper-content white-bg">
<div class="row">
<div class="col-md-12">
	<form class="form-horizontal" name="iEditForm" id="iEditForm" action="##" method="post">
		<input type="hidden" name="productID" value="${entityOne.productID}" />
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">ID</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="id" name="id" value="${entityOne.id}" readonly="readonly">
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">编号</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="code" name="code" value="${entityOne.code}">
					</div>
				</div>
			</div>
		</div>
	
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">字符型</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="stringx" name="stringx" value="${entityOne.stringx}">
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">整数型</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="intx" name="intx" value="${entityOne.intx}">
					</div>
				</div>
			</div>
		</div>
	
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">长整数型</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="longx" name="longx" value="${entityOne.longx}">
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">双精度型</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="doublex" name="doublex" value="${entityOne.doublex}">
					</div>
				</div>
			</div>
		</div>
	
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">日期型</label>
					<div class="col-md-10">
						<input type="text" class="laydate-icon form-control layer-date" id="datex" name="datex" value="${entityOne.datex}">
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">长日期型</label>
					<div class="col-md-10">
						<input type="text" class="laydate-icon form-control layer-date" id="datetimex" name="datetimex" value="<fmt:formatDate value="${entityOne.datetimex}" pattern="yyyy-MM-dd HH:mm:ss" />">
					</div>
				</div>
			</div>
		</div>
	
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">时间型</label>
					<div class="col-md-10">
						<div class="clockpicker" data-autoclose="true">
                            <input type="text" class="laydate-icon form-control layer-date" id="timex" name="timex" value="<fmt:formatDate value="${entityOne.timex}" pattern="HH:mm" />">
                        </div>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">是否选择</label>
					<div class="col-md-10">
						<select name="yesno" id="yesno" class="form-control s-b">
							<c:forEach items="${yesNoEnums}" var="yesNoEnum">
								<option value='<c:out value="${yesNoEnum.id}"/>'<c:if test="${entityOne.yesno}">selected</c:if>>
									<c:out value="${yesNoEnum.value}" />
								</option>
							</c:forEach>
						</select>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">结束标志</label>
					<div class="col-md-10">
						<div class="checkbox checkbox-primary">
							<input type="checkbox" id="finishedflag" name="finishedflag" value="true" ${entityOne.finishedflag=='true'? 'checked':''}><label for="finishedflag"></label>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">产品名称</label>
					<div class="col-md-10">
						<div class="input-group m-b">
							<input type="text" class="form-control" id="productName" name="productName" value="${entityOne.productName}"><span class="input-group-btn"><button type="button" class="btn btn-primary">选择</button></span>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-md-2 control-label">排序号</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="sort" name="sort" value="${entityOne.sort}">
					</div>
				</div>
			</div>
		</div>
		
		<div class="row">
			<div class="col-md-1">
				<div class="form-group">
					<label class="col-md-12 control-label">备注</label>
				</div>
			</div>
			<div class="col-md-11">
				<div class="form-group">
					<div class="col-md-12">
						<textarea class="form-control" rows="3" id="remark" name="remark">remark</textarea>
					</div>
				</div>
			</div>
		</div>
	</form>
</div>
</div>
</div>
</body>
<!-- 全局js -->
<script type="text/javascript" src="${ctxPath}/assets/global/js/jquery.min.js?v=2.1.4"></script>
<script type="text/javascript" src="${ctxPath}/assets/global/js/bootstrap.min.js?v=3.3.6"></script>
<!-- Chosen -->
 <script src="${ctxPath}/assets/global/js/plugins/chosen/chosen.jquery.js"></script>
<!-- 表单 -->
<script type="text/javascript" src="${ctxPath}/assets/global/js/shortcut.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/global/js/plugins/layer/laydate/laydate.js"></script>
<!-- Clock picker -->
<script type="text/javascript" src="${ctxPath}/assets/global/js/plugins/clockpicker/clockpicker.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/global/js/plugins/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/global/js/plugins/validate/messages_zh.min.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/global/js/jquery.form-3.51.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	shortcut.add("Enter", function(e) {
		sendTabKeyByShortcut(e);
	}, {
		'type' : 'keydown',
		'propagate' : true,
		'disable_in_input' : false,
		'target' : document.getElementById("iEditForm"),
		'keycode' : true
	});

	shortcut.add("Ctrl+S", function(e) {
		fnSaveChange();
	}, {
		'type' : 'keydown',
		'propagate' : false,
		'disable_in_input' : false,
		'target' : document,
		'keycode' : false
	});
	

	var icon = "<i class='fa fa-times-circle'></i>";
	$("#iEditForm").validate({
		rules : {
			code : "required",
			stringx : "required",
			intx : {
				required : true,
				minlength : 2
			}
		},
		messages : {
			code : icon + "请输入code",
			stringx : icon + "请输入stringx",
			intx : {
				required : icon + "请输入intx",
				minlength : icon + "intx必须两个字符以上"
			}
		}
	});
	
	laydate({
		elem : '#datex',
		format : 'YYYY-MM-DD',
		event : 'click'
	});
	
	laydate({
		elem : '#datetimex',
		format : 'YYYY-MM-DD hh:mm:ss',
		istime : true,
		event : 'click'
	});
	
	$("#btnReset").click(function() {
		iEditForm.reset();
	});
	
	$("#btnSave").click(function() {
		fnSaveChange();
	});
	
	 $('.clockpicker').clockpicker();
	// 焦点
	focusonFirst();
});

function fnSaveChange() {
	var uuid = "${param.key}";
	var tmpFlag = $("#iEditForm").validate().form();
	if (tmpFlag) {
		if (uuid == "-1" || uuid == "") {
			iEditForm.action = "${ctxPath}/entityOne/add.do";
		} else {
			iEditForm.action = "${ctxPath}/entityOne/update.do";
		}
		iEditForm.submit();
	}
}
</script>
    
</html>